package com.zhongying.jf.util;

import com.zhongying.jf.ResConstants;
import com.zhongying.jf.cache.Jiucache;
import com.zhongying.jf.exception.ZhongyingiException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

/**
 * @author liyuxuan
 * @Description
 * @Email liyuxuan@chinazyjr.com
 * Created on 2017/8/23 16:52
 * Copyright (c) 2017 All Rights Reserved.
 */
public class TokenUtil {

    private static final Logger LOGGER = LoggerFactory.getLogger(Jiucache.class);

    /**
     * 获取token
     * @return
     */
    public static String getToken(){
        String token = "";
        try {
            token = UUID.randomUUID().toString().replaceAll("-", "");
        } catch (Exception e) {
            LOGGER.error("获取token异常" + e);
            throw new ZhongyingiException(ResConstants.GET_TOKEN_EXCEPTION.getCode(), ResConstants.GET_TOKEN_EXCEPTION.getMsg());
        }
        return token;
    }
    
}
